package com.project.weather.controller;

import com.project.weather.aspectj.Log;
import com.project.weather.common.AResultCode;
import com.project.weather.common.ResultMap;
import com.project.weather.enums.BusinessType;
import com.project.weather.pojo.api.WeatherLiveResponsePojo;
import com.project.weather.pojo.api.WeatherRequestPojo;
import com.project.weather.pojo.api.WeatherSevendaysResponsePojo;
import com.project.weather.service.WeatherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


/**
 *<p>Title:UserController.java</p>
 *<p>Description:查询天气 Action</p>
 *@author xxx
 *@version 1.0
 *@Automatically generate by Coder in 2021-12-21 16:07
 */
@RestController
@RequestMapping(name="查询天气", value="/weather/")
@Api(tags = {"查询天气 Api 接口文档"})
public class WeatherController {
    private static final Logger log = LoggerFactory.getLogger(WeatherController.class);

    @Autowired
    private WeatherService weatherService;

    @ApiOperation(value="查询当天天气")
    @Log(title = "查询当天天气", businessType = BusinessType.SEARCHLIVE)
    @RequestMapping(name="查询当天天气",value="searchLive.json",method = RequestMethod.POST)
    public ResultMap<AResultCode, WeatherLiveResponsePojo> searchLive(@ApiParam(value = "对象数据", required = true) @RequestBody(required = false) WeatherRequestPojo bean){
        return weatherService.searchLive(bean);
    }

    @ApiOperation(value="查询未来7天天气")
    @Log(title = "查询未来7天天气", businessType = BusinessType.SEARCHSEVENDAYS)
    @RequestMapping(name="查询未来7天天气",value="searchSevenDays.json",method = RequestMethod.POST)
    public ResultMap<AResultCode, WeatherSevendaysResponsePojo> searchSevenDays(@ApiParam(value = "对象数据", required = true) @RequestBody(required = false) WeatherRequestPojo bean){
        return weatherService.searchSevenDays(bean);
    }

}
